<template>
    <div id="news">
        <!--返回顶部-->
        <div class="gotop" @touchstart.stop.prevent="goToTop">
            <a href="javascript:void(0);">
                <p class="iconfont">&#xe62e;</p>
                <p>顶部</p>
            </a>
        </div>
        <!--头部-->
        <div class="head">
            <span class="iconfont" onclick="javascript :history.go(-1);">&#xe602;</span>
            <div class="title-img">
                <a href="/">
                    <img src="./images/new_title_img.png" alt="">
                </a>
            </div>
        </div>

        <!--轮播图-->
        <div class="swiper-container">
            <div class="swiper-wrapper">
                <div class="swiper-slide">
                    <a href="javascript:void(0);">
                        <img src="./images/banner01.png" alt="">
                    </a>
                </div>
                <div class="swiper-slide">
                    <a href="javascript:void(0);">
                        <img src="./images/banner01.png" alt="">
                    </a>
                </div>
                <div class="swiper-slide">
                    <a href="javascript:void(0);">
                        <img src="./images/banner01.png" alt="">
                    </a>
                </div>
            </div>
        </div>

        <!--创业资讯和品牌资讯-->
        <el-tabs v-model="activeName" @tab-click="">
            <el-tab-pane label="创业资讯" name="first">
                <ul class="news-opt" id="news-opt">
                    <li>
                        <router-link to="/newsinfo" tag="a" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </router-link>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="w set2">
                            <div class="no-top">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                            <div class="img-box">
                                <img src="./images/news_set2_01.jpg" alt="">
                                <img src="./images/news_set2_02.jpg" alt="">
                                <img src="./images/news_set2_03.jpg" alt="">
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="w set2">
                            <div class="no-top">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                            <div class="img-box">
                                <img src="./images/news_set2_01.jpg" alt="">
                                <img src="./images/news_set2_02.jpg" alt="">
                                <img src="./images/news_set2_03.jpg" alt="">
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="load-more" id="load1">加载更多项目</a>
                    </li>
                    <li class="hide">
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="w set2">
                            <div class="no-top">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                            <div class="img-box">
                                <img src="./images/news_set2_01.jpg" alt="">
                                <img src="./images/news_set2_02.jpg" alt="">
                                <img src="./images/news_set2_03.jpg" alt="">
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="/newsinfo.html" class="w set1">
                            <img src="./images/news_img.jpg" alt="">
                            <div class="no-right">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="w set2">
                            <div class="no-top">
                                <p>五万块钱能开餐饮店吗？来看看这家小店怎么样？</p>
                                <p>五万块钱能开什么样的餐饮店呢？</p>
                            </div>
                            <div class="img-box">
                                <img src="./images/news_set2_01.jpg" alt="">
                                <img src="./images/news_set2_02.jpg" alt="">
                                <img src="./images/news_set2_03.jpg" alt="">
                            </div>
                        </a>
                        <a href="javascript:void(0);" class="load-more" id="load2">加载更多项目</a>
                    </li>

                </ul>
            </el-tab-pane>
            <el-tab-pane label="品牌资讯" name="second">品牌资讯</el-tab-pane>
        </el-tabs>

        <foot></foot>
    </div>
</template>

<script>
    // swiper
    import Swiper from "swiper"
    import foot from "@/components/foot/foot"

    export default {
        name: "News",
        data() {
            return {
                activeName: "first",
            }
        },
        methods: {
            thisLbt() {
                var mySwiper = new Swiper('.swiper-container', {
                    // slidesPerView : 3,
                    // centeredSlides : true,
                    // spaceBetween : 20,
                    // slidesOffsetBefore : 100,
                    loop: true,
                    slidesPerView: 'auto',
                    loopedSlides: 5,
                })
            },
            //  返回顶部按钮的显隐
            btnShow() {
                let back = document.querySelector(".gotop")
                window.addEventListener("scroll", function () {
                    let webScroll = document.documentElement.scrollTop;
                    // console.log(webScroll)
                    if (webScroll >= 200) {
                       back.style.display = "block"
                    } else if (webScroll < 200) {
                        back.style.display = "none"
                    }
                })
            },
            // 返回顶部
            goToTop(){
                let topTime = setInterval(function () {
                    var top = document.body.scrollTop || document.documentElement.scrollTop;
                    var speed = top / 10;
                    if (document.body.scrollTop!==0) {
                        document.body.scrollTop -= speed;
                    }else {
                        document.documentElement.scrollTop -= speed;
                    }
                    if (top === 0) {
                        clearInterval(topTime);
                    }
                }, 3);
            },
        },
        mounted() {
            this.thisLbt()
            this.btnShow()
        },
        created() {

        },
        components: {
            foot
        }
    }
</script>

<style lang="less">
    @import "../../../node_modules/swiper/dist/css/swiper.min.css";

    #news {
        /* 返回顶部 */

        .gotop {
            width: 0.3rem;
            height: 0.4rem;
            background-color: #c6c6c6;
            position: fixed;
            right: 0;
            top: 450px;
            z-index: 100;
            border-top: 1px solid transparent;

            a {
                display: block;
                width: 100%;
                height: 100%;

                p {
                    margin-bottom: 0 !important;
                    text-align: center;
                    font-size: 10px;
                    color: #fff;
                    line-height: 10px;

                    &:nth-of-type(1) {
                        margin-top: 5px;
                        margin-bottom: 5px !important;
                    }
                }
            }
        }

        /* 头部 */

        .head {
            //width: 100%;
            width: 3.325rem;
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%);
            height: 0.5rem;
            box-shadow: 0 -6px 20px rgba(0, 0, 0, .1);
            background-color: #fff;
            z-index: 999;

            span {
                position: absolute;
                top: 0.15rem;
                left: 0;
            }

            .title-img {
                width: 1.1rem;
                margin: 0 auto;
                padding-top: 0.15rem;

                a {
                    display: block;
                    width: 100%;
                    height: 100%;

                    img {
                        display: block;
                        width: 100%;
                    }
                }
            }

            &::after {
                content: "";
                position: absolute;
                top: 0;
                left: -0.23rem;
                width: 0.23rem;
                height: 100%;
                background-color: #fff;
                z-index: 9999;
            }

            &::before {
                content: "";
                position: absolute;
                top: 0;
                right: -0.21rem;
                width: 0.42rem;
                height: 100%;
                background-color: #fff;
                z-index: 9999;
            }
        }

        .swiper-container {
            margin-top: .65rem;
            margin-bottom: .15rem;
            padding-left: 15px;
            padding-right: 15px;

            a {
                display: block;
                width: 100%;

                img {
                    display: block;
                    width: 98%;
                    margin: 0 auto;
                }
            }
        }

        /* 导航居中 */

        .el-tabs__nav {
            width: 100%;
        }

        .el-tabs__item {
            width: 50%;
            text-align: center;
            font-size: 16px;
            color: #999;
            height: .45rem;
            /*font-weight: bold;*/
            outline: 0;
            padding: 0;

            &.is-active {
                color: #333;
                position: relative;

                &::after {
                    content: "";
                    position: absolute;
                    width: .3rem;
                    height: 2px;
                    bottom: 0;
                    left: 50%;
                    transform: translateX(-50%);
                    background-color: #fe1818;
                    border-bottom: 2px;
                }
            }
        }

        /* 导航条底部边框的颜色 */

        .el-tabs__active-bar {
            background-color: transparent !important;
        }

        .el-tabs__active-bar {
            height: 1px !important;
        }

        .el-tabs__nav-wrap::after {
            height: 1px;
            background-color: #dcdcdc;
        }


        .news-opt {
            li {
                p {
                    margin-bottom: 0 !important;
                }

                .set1 {
                    display: flex;
                    justify-content: space-between;
                    padding-top: 0.15rem;
                    padding-bottom: 0.15rem;
                    border-bottom: 1px solid #eaeaea;

                    img {
                        flex: 0 0 0.13rem;
                        height: 0.9rem;
                        margin-right: 0.1rem;
                    }

                    .no-right {
                        flex: 0 0 1.94rem;
                        position: relative;

                        p {
                            overflow: hidden;
                            text-overflow: ellipsis;
                            display: -webkit-box;
                            -webkit-line-clamp: 2;
                            -webkit-box-orient: vertical;

                            &:nth-of-type(1) {
                                color: #333;
                                font-size: 15px;
                                font-weight: bold;
                                margin-top: 0.12rem;
                            }

                            &:nth-of-type(2) {
                                font-size: 12px;
                                color: #666;
                                overflow: hidden;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                                vertical-align: bottom;
                                position: absolute;
                                left: 0;
                                bottom: 0.05rem;
                            }
                        }
                    }
                }

                .set2 {
                    display: block;
                    width: 100%;
                    height: 100%;
                    padding: 0.15rem;
                    padding-bottom: 0.15rem;
                    border-bottom: 1px solid #eaeaea;

                    .no-top {
                        p {
                            &:nth-of-type(1) {
                                font-weight: bold;
                                font-size: 15px;
                                overflow: hidden;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                                color: #3b3b3b;
                            }

                            &:nth-of-type(2) {
                                color: #444;
                                font-size: 12px;
                                overflow: hidden;
                                white-space: nowrap;
                                text-overflow: ellipsis;
                                margin-top: 0.15rem;
                                margin-bottom: 0.1rem !important;
                            }
                        }
                    }

                    .img-box {
                        display: flex;
                        justify-content: space-between;

                        img {
                            flex: 0 0 1.1rem;
                            height: 0.77rem;
                        }
                    }
                }
            }
        }

        .load-more {
            display: block;
            font-size: 12px;
            color: #424242;
            padding: 0.17rem 0;
            text-align: center;
            border-bottom: none !important;
        }

    }

</style>
